<?php
session_start();

if(!isConnected()) {
    header('location: ../employe/login.php');
    die();
}

function isConnected() {
    if(empty($_SESSION['auth']->role) || ($_SESSION['auth']->role != 'ADMIN' && $_SESSION['auth']->role != 'AGENT')) {
        return false;
    } else {
        return true;
    }
}

function getSession() {
    return !empty($_SESSION['auth']) ? $_SESSION['auth'] : new stdClass() ;
}
